package br.com.dubs.persistence.dao;

import java.util.List;

import javax.ejb.Stateless;
import javax.persistence.Query;

import br.com.dubs.persistence.entities.ClientEntity;

@Stateless
public class ClientDAO extends GenericDAO<ClientEntity> {
	public ClientEntity checkLogin(String Login, String Password) {
		List<ClientEntity> clientresult;
		ClientEntity results = null;
		Query query = em
				.createQuery("SELECT c FROM ClientEntity c WHERE c.login = :login AND c.password = :password");
		query.setParameter("password", Password);
		query.setParameter("login", Login);
		clientresult = query.getResultList();
		if (clientresult.size() > 0) {
			results = clientresult.get(0);
		}
		return results;
	}
}
